package com.runshu.newsmartark.mvp.presenter;

import com.runshu.newsmartark.mvp.contract.MainHomeContract;
import com.runshu.newsmartark.network.netbean.ResponseBean;
import com.runshu.newsmartark.network.netinterface.MyCallBack;

/**
 * Demo class
 *
 * @author yu
 * @date 2020/10/27
 * @decs：
 */

public class MainHomePresenter implements MainHomeContract.Presenter {

    private MainHomeContract.View view;
    private MainHomeContract.Model model;

    public MainHomePresenter(MainHomeContract.View view, MainHomeContract.Model model) {
        this.view = view;
        this.model = model;
    }



    @Override
    public void getIndexCount(String mac) {
        model.getIndexCount(mac, new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.getIndexCount(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.onError(data.getMessage());
            }
        });
    }

    @Override
    public void getInventorySum(String customerId, String hospitalId, String hwMac) {
        model.getInventorySum(customerId, hospitalId, hwMac, new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.getInventorySumSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.onError(data.getMessage());
            }
        });
    }

    @Override
    public void getHdInfo(String hwMac) {
        model.getHdInfo(hwMac, new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.getHdInfoSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.onError(data.getMessage());
            }
        });
    }
}